﻿using RAP.Framework.Libary.DomTemplateBuilder.Configuration;
using RAP.Framework.Libary.DomTemplateBuilder.Element.Parameter;
using System;
using System.Collections.Generic;
using System.Text;

namespace RAP.Framework.Libary.DomTemplateBuilder.Interface
{
	/// <summary>
	/// 渲染模板时的上下文对象
	/// </summary>
	public interface ITemplateRenderContext : System.Collections.IDictionary, IDisposable
	{
		/// <summary>
		/// 参数上下文
		/// </summary>
		ParameterCollection Parameters { get; }

    /// <summary>
    /// 获取当前模板的Attributes集合
    /// </summary>
    AttributeCollection CurrentAttributes { get; set; }

    /// <summary>
    /// 模板的回调函数，可在模板内通过特殊节点调用
    /// </summary>
    IList<Action<object, ITemplateRenderContext>> Callbacks { get; }

		/// <summary>
		/// 
		/// </summary>
		/// <param name="param"></param>
		/// <param name="context"></param>
		Action<object> DoCallbacks { get; set; }

		/// <summary>
		/// 是否结束当前模板的渲染
		/// </summary>
		bool EndTemplate { get; set; }

		/// <summary>
		/// 是否退出当前循环或Switch
		/// </summary>
		bool IsBreak { get; set; }

		/// <summary>
		/// 回调时的结果对象
		/// </summary>
		object CallbackResult { get; set; }
	}
}
